package nio.demo;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @author ZH
 */
public class Client {
    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("localhost",8080));
        System.out.println();
        socketChannel.write(Charset.defaultCharset().encode("123456789abcdefgh123456789\nworld\n123\n"));
        System.in.read();
    }
}
